package com.lt.exam.ZhuangShiQi.ShiXian;

import com.lt.exam.Yao.Yao;
import com.lt.exam.ZhuangShiQi.BingLi;
import com.lt.exam.ZhuangShiQi.BingLiZhuangShiQi;

import java.util.List;

/**
 * @author LT
 * @version 1.0
 * @PackageName com.lt.exam.ZhuangShiQi.Impl
 * @ClassName XiaoShiPian
 * @Description to do
 * @date 2021/12/1 16:26
 */
public class XiaoShiPian extends BingLiZhuangShiQi {
    @Override
    public double cost() {
        double price = 0.0;
        for (Yao yao : getList()){
            price += yao.getPrice();
        }
        return price;
    }

    @Override
    public String getDescription() {
        String des = "";
        for (Yao yao : getList()){
            des += yao.getDescription();
        }
        return des;
    }

    @Override
    public List<Yao> getList() {
        return bingli.getList();
    }

    @Override
    public void add(Yao yao) {

    }

    @Override
    public void delete(Yao yao) {

    }


    public XiaoShiPian(BingLi bingli) {
        super(bingli);
        bingli.getList().add(super.getYaoMap().get("消食片"));
    }
}
